package com.earthea.application.mapper;

import com.earthea.application.task.entity.Task;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface TaskMapper {

    int batchAdd(@Param("tableName") String tableName, @Param("tasks") List<Task> tasks);

    List<Task> query(@Param("tableName") String tableName, @Param("type") String type, @Param("label") String label,
                     @Param("status") int status, @Param("limit") int limit);

    int batchUpdateToProcessing(@Param("tableName") String tableName, @Param("tasks") List<Task> tasks, @Param(
            "clientIp") String clientIp);

    int batchUpdateProcessing(@Param("tableName") String tableName, @Param("updateTime") String updateTime, @Param(
            "limit") int limit);

    int batchUpdateTask(@Param("tableName") String tableName, @Param("tasks") List<Task> tasks);

    List<Task> queryByHistory(@Param("tableName") String tableName, @Param("limit") int limit);

    int batchDelete(@Param("tableName") String tableName, @Param("tasks") List<Task> tasks);

    int batchAddHistory(@Param("tableName") String tableName, @Param("tasks") List<Task> tasks);

    void create(@Param("tableName") String tableName);

    void createHistory(@Param("tableName") String tableName);
}
